package com.cskaoyan._02charstream._01why;

import java.io.FileInputStream;
import java.io.IOException;

/**
 * @description:
 * @author: 景天
 * @date: 2023/2/18 10:16
 **/

public class Demo {
    public static void main(String[] args) throws IOException {
        // 使用字节流读取英文数字 中文
        // 创建输入流对象
        FileInputStream in = new FileInputStream("a.txt");
        // read
        //while (true) {
        //    int readData = in.read();
        //    if (readData == -1) {
        //        break;
        //    }
        //    System.out.print(((char) readData));
        //
        //}


        byte[] bytes = new byte[11];
        // int readCount = in.read(bytes);

        int readCount;
        while ((readCount = in.read(bytes)) != -1) {
            System.out.println(new String(bytes,0,readCount));
        }


        // close
        in.close();

    }
}
